/**
 * 
 */
package com.haizhi.service.impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;

import com.haizhi.service.BaseService;

/**
 * @author jiangjintai
 * @param <T>
 * @param <B>
 *
 */
public abstract class BaseServiceImpl<T, B extends Serializable> implements BaseService<T, B> {
	protected abstract JpaRepository<T, B> getDao();
	@Override
	public T findById(B id) {
		// 
		return getDao().findOne(id);
	}

	@Override
	public T save(T entity) {
		// 
		return getDao().save(entity);
	}

	@Override
	public void delete(T entity) {
		// 
		getDao().save(entity);
	}

	@Override
	public List<T> findAll() {
		// 
		return getDao().findAll();
	}

	@Override
	public void deleteById(B id) {
		// 
		getDao().delete(id);
	}
	
}
